package com.san.hkhospital.service.impl;

import com.san.hkhospital.dto.Medbuy1;
import com.san.hkhospital.vo.MedbuyVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.san.hkhospital.entity.MedBuy;

import java.util.Date;
import java.util.List;
import com.san.hkhospital.mapper.MedBuyMapper;
import com.san.hkhospital.entity.MedBuyExample;
import com.san.hkhospital.service.MedBuyService;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName:MedBuyServiceImpl
 * PackageName:com.san.hkhospital.service.impl
 * Description:
 *
 * @Author:yy
 * @CreatedAt:2024/11/13 14:38
 * 
 */
 
 
@Service
@Transactional
public class MedBuyServiceImpl implements MedBuyService{

    @Resource
    private MedBuyMapper medBuyMapper;

    @Override
    public long countByExample(MedBuyExample example) {
        return medBuyMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(MedBuyExample example) {
        return medBuyMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer medId) {
        return medBuyMapper.deleteByPrimaryKey(medId);
    }

    @Override
    public int insert(MedBuy record) {
        return medBuyMapper.insert(record);
    }

    @Override
    public int insertSelective(MedBuy record) {
        return medBuyMapper.insertSelective(record);
    }

    @Override
    public List<MedBuy> selectByExample(MedBuyExample example) {
        return medBuyMapper.selectByExample(example);
    }

    @Override
    public MedBuy selectByPrimaryKey(Integer medId) {
        return medBuyMapper.selectByPrimaryKey(medId);
    }

    @Override
    public int updateByExampleSelective(MedBuy record,MedBuyExample example) {
        return medBuyMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(MedBuy record,MedBuyExample example) {
        return medBuyMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(MedBuy record) {
        return medBuyMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(MedBuy record) {
        return medBuyMapper.updateByPrimaryKey(record);
    }

    @Override
    public boolean buymedicine(MedBuy medBuy) {
        medBuy.setCreateTime(new Date());
        return medBuyMapper.insertSelective(medBuy)>0?true:false;
    }

    ////////////////////////////////////////////////////////////////////////

    @Override
    public List<MedBuy> medbuyList() {
        return medBuyMapper.selectByExample(null);
    }

    @Override
    public List<MedbuyVo> search(Medbuy1 medbuy1) {
        List<MedbuyVo> search = medBuyMapper.search(medbuy1);
        return search;
    }
}
